function ajax_post(){
	var username = $("#username").val();
	var password = $("#pword").val();

	$.ajax({
		type: "post",
		url : "login.php",
		beforeSend : function(){
			show_loading();
		},
		data : "action=login&username="+username+"&password="+password,
		success: function(data, textStatus){
			$('#loginboxx').html(data);
			var  sarray=new  Array();   
			sarray= data.split("||||");
		    if(sarray[1]!='error'){
				window.location.href = sarray[1];
			}       
		}
	});
	return false;
}

function show_loading(){
     $('#loadp').html("<img src='images/ajax.gif' align=\"absmiddle\">");
}


function ajax_logout(){
    var myajax = new Ajax.Request("login.php",{method:'post',parameters: "action=logout",onLoading:show_loading,onComplete:show_result});
	return false;
}

function view(id){
   document.getElementById(id).value = '';
}

function ajax_out(){
	$.ajax({
		type: "post",
		url : "login.php",
		beforeSend : function(){
			show_loading();
		},
		data : "action=logout2",
		success: function(){
			show_result2();
		}
	});
	return false;
}
function show_result2(response){
     window.location.href="index.php";
}
function del(url){
    if(confirm("Sure you want to delete?")){
	   window.location.href = url;
	}
}
function turnto(url){
   window.location.href = url;
}

function CheckAll(va){
	var va;
	var a = document.getElementsByName(va);
    var n = a.length;
	for (var i=0;i<n;i++){
      a[i].checked = true;
	}
}

function CheckOutAll(va){
	var va;
	var a = document.getElementsByName(va);
    var n = a.length;
	for (var i=0;i<n;i++){
      a[i].checked = false;
	}
}

function cksubmit(appid){
	var appid;
    if(confirm("Sure you want to submit?")){
	   window.location.href = "applicantdetails.php?id="+appid+"&submit=1";
	}
}

function getHTML (id, url ,num,type) {
	var url;
	var pars = "type="+type+"&flag="+num;
	
	$.post(
		url, 
		{ type: type, flag: num },
		function(data, textStatus){
			$(id).html(data);
		}
	); 
	return false;
}

function checkdelall(){
    var a = document.getElementsByName('del[]');
    var n = a.length;
	for (var i=0;i<n;i++){
      if(a[i].checked == true){
         var tr = 1;
	  }
	}
	if(tr == 1){
		if(confirm("Sure you want to delete?")){
			return true;
		}
	}else{
		alert('Please select a record to be deleted.');
		return false;
	}
	return false;
}

function connectR(id,url){
   if(confirm("To learn more about or interview this applicant please connect with the recruiter by clicking on the 'OK' button below.  Once you click on 'OK', our system will release to you the contact information of the recruiter representing this applicant.  You may then contact them directly via phone or email.  By clicking the 'OK' button below, you are not obligated to hire this candidate.  Feel free to contact your enetRecruiter account manager if you have any questions.  Thank you.")){
	   window.location.href = url;
	}else{
	   document.getElementById(id).checked = false;
	}
}

function enetconfirm(info,url){
	if(confirm(info)){
	   window.location.href=url;
	}
}

function reallyCenterWindow(url) {
	leftPos = 0
	topPos  = 0
	if (screen) {
	leftPos = (screen.width / 2) - 251
	topPos = (screen.height / 2) - 251
	}
	ElementWindow = window.open(url,'ElementWin','width=502,height=502,left='+leftPos+',top='+topPos);
} 

function cc(tt){   
	var   aa   =   document.getElementsByName("postid");   
	for   (var   i=0;   i<aa.length;   i++) {aa[i].checked   =   false;}  
}   


function suretocancel(url){
    if(confirm("Sure you want to cancel membership?")){
	   window.location.href = url;
	}
}


function buysubmit(u) {
	var u;
	if(u=='Buy Now'){
	document.getElementById('sam').value = 'Buy Now'; 
	}
	if(u=='Try Now'){
	document.getElementById('sam').value = 'Try Now'; 
	}
	document.getElementById('article').submit();
}